import Vue from 'vue'
import VueRouter from "vue-router";
// 引入组件 @从根目录下引入组件
import Login from '@/components/Login'
import MainPage from '@/components/MainPage'

import AssetReg from '@/components/reg/AssetReg'
import AssetRegMain from '@/components/reg/AssetRegMain'
import AssetRegModal from '@/components/reg/Modal'

import Index from '@/components/home/Index'
import AssetInventory from '@/components/inventory/AssetInventory'
import InventoryNotice from '@/components/inventory/InventoryNotice'
import InventorySummary from '@/components/inventory/InventorySummary'

Vue.use(VueRouter);

const routes = [
  {
    path: "/login", component: Login
  },
  {
    path: "/main", component: MainPage, children: [
      {
        path: 'reg', component: AssetReg, children: [
          {
            path: "", component: AssetRegMain, children: [
              {path: "modal", component: AssetRegModal}
            ]
          }
        ]
      },
      {
        path: 'inventory', component: AssetInventory, children: [
          {
            path: "", component: InventoryNotice
          }, {
            path: "summary", component: InventorySummary
          }
        ]
      },
      {path: 'index', component: Index},
      {path: '*', redirect: "/main/reg"},
      {path: '', redirect: "/main/reg"}
    ]
  },
  {path: '', redirect: "/login"}

]

// 暴露router
export default new VueRouter({
  linkActiveClass: 'active',  // 选中样式的切换
  routes // (缩写) 相当于 routes: routes
})
